<?php //pack11class

class MainMenu extends Module {

    public $traceEnabled=true;

    public function setup() {
        $levels=PropertiesManager::getLevel(0);
        $this->setItems($levels[0]);
    }

    private function setItems(Property $_property) {

        $property=clone $_property;

        $values=MySQLGet::process("Select `id`,".LanguagesManager::sql()." from ".MySQL::TABLE_VALUES." where `property`='{$_property->id}';");
        foreach($values as $value) {
            $item= new MainMenuItem;
            $property->value=$value["id"];
            $queryObject=new GetQueryObject;
            $queryObject->setValue($property);
            $query=GetQuery::generate($queryObject);
            if($_property->value==$value["id"] && !array_key_exists("search", $_GET)) {
                //$item->setLink($value["value"]);
                $item->setLink(ValuesManager::getValueByID($value["id"]));
            } else {
                $item->setLink(ValuesManager::getValueByID($value["id"]),$query);
            }
            $item->width=floor(100/count($values))."%";
            $this->addChild($item);
        }
        
    }

}
?>
